// 目的：利用 forward_list 管理嵌入式任务，节点轻量、遍历一次即可完成批处理。
#include <forward_list>
#include <iostream>

struct Job {
    int id;
    void run() const { std::cout << "Run job " << id << '\n'; }
};

class JobQueue {
public:
    void push(Job job) {
        jobs_.push_front(std::move(job));
    }

    void executeAll() {
        for (const auto& job : jobs_) {
            job.run();
        }
        jobs_.clear();
    }

private:
    std::forward_list<Job> jobs_;
};

int main() {
    JobQueue queue;
    queue.push({1});
    queue.push({2});
    queue.push({3});
    queue.executeAll();
    return 0;
}